﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using _619BJP.Database.Brand;
using _619BJP.Models;
using System.Data;
using _619BJP.Database.Product;

namespace _619BJP.Web.Controllers
{
    public class BrandController : Controller
    {
        //
        // GET: /Brand/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult BrandIndex()
        {
            return View();
        }

        /// <summary>
        /// 得到所有品牌
        /// </summary>
        /// <returns></returns>
        public DataSet GetAllBrands()
        {
            brandDB brandDB = new brandDB();
            DataSet ds = brandDB.getAllBrands();
            return ds;
        }

        /// <summary>
        /// 保健品牌详细
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult BrandDetails(int id)
        {
            brandDB brandDB = new brandDB();
            BrandModel brandModel = brandDB.brandDetail(id);

            ViewData.Model = brandModel;
            ViewData["Title"] = brandModel.name;
            return View();
        }

        /// <summary>
        /// 某品牌下的部分产品列表
        /// </summary>
        /// <returns></returns>
        public DataSet GetPartProductsByBrand(int brand_id,int count)
        {
            productDB productDB = new productDB();
            DataSet ds = productDB.GetProductByBrand(brand_id, count);
            return ds;
        } 

        /// <summary>
        /// 某品牌下的产品列表
        /// </summary>
        /// <returns></returns>
        public DataSet GetAllProductsByBrand(int brand_id)
        {
            productDB productDB = new productDB();
            DataSet ds = productDB.GetProductByBrand(brand_id,0);
            return ds;
        } 

    }
}
